<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"></meta>
    <title>Example If/Unless </title>
    <meta name="author" content="pan_junbiao的博客">
    <style>
        table{
            border-top: 1px solid #000000;
            border-left: 1px solid #000000;
            border-collapse: collapse; /*设置单元格的边框合并为1*/
        }
        th{
            text-align: right;
        }
        th, td{
            border-bottom: 1px solid #000000;
            border-right: 1px solid #000000;
            padding: 5px 10px;
        }
        select{
            width: 100px;
            padding: 3px;
        }
    </style>
</head>
<body>
<script th:inline="javascript">
    function doUpdateUI(id) {
        //执行删除业务
        location.href = `http://localhost/brand/doFindById/${id}`;
    }

    function doDeleteById(id) {
        //给出提示信息
        if (!confirm("您确认删除吗")) return;//confirm为浏览器中window对象的函数
        //执行删除业务
        location.href = `http://localhost/brand/doDeleteById/${id}`;
    }

    function doAddUI() {
        location.href = "/brand/doAddUI";
    }

</script>
<div>
    <table th:border="1px" style="font-size: 16px;height: 200px;width: 600px">
        <thead>
        <tr>
            <th>id</th>
            <th>name</th>
            <th>remark</th>
            <th>createdTime</th>
        </tr>
        </thead>
        <tbody>
        <tr th:border="1px" th:each="brand: ${list}">
            <td th:text="${brand.id}">10</td>
            <td th:text="${brand.name}">AAA</td>
            <td th:text="${brand.remark}">remark</td>
            <td th:text="${#dates.format(brand.createdTime, 'yyyy/MM/dd HH:mm')}">2020/10/11</td>
            <td>
                <button type="button" onclick="doAddUI()" class="btn btn-primary btn-sm">Add Brand</button>
                <button type="button" th:onclick="doDeleteById([[${brand.id}]])">delete</button>
                <button type="button" th:onclick="doUpdateUI([[${brand.id}]])">update</button>
            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>
